package com.csii.activiti.server.starter;

import org.springframework.boot.autoconfigure.AutoConfigurationImportFilter;
import org.springframework.boot.autoconfigure.AutoConfigurationMetadata;

public class ExcludeAutoConfigurationImportFilter implements AutoConfigurationImportFilter {

    private final static String EXCLUDE_CLASS = "org.activiti.spring.boot.SecurityAutoConfiguration";


    @Override
    public boolean[] match(String[] autoConfigurationClasses, AutoConfigurationMetadata autoConfigurationMetadata) {
        boolean [] match = new boolean[autoConfigurationClasses.length];

        for (int i = 0; i < autoConfigurationClasses.length; i++) {
            String autoConfigurationClass = autoConfigurationClasses[i];
            match[i] = true;
            if (EXCLUDE_CLASS.equals(autoConfigurationClass)){
                match[i] = false;
            }
        }


        return match;
    }
}
